package com.ys.nms.module.business.dal.mysql.links;

import java.util.*;

import com.ys.nms.framework.common.pojo.PageResult;
import com.ys.nms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ys.nms.framework.mybatis.core.mapper.BaseMapperX;
import com.ys.nms.module.business.dal.dataobject.links.LinksDO;
import org.apache.ibatis.annotations.Mapper;
import com.ys.nms.module.business.controller.admin.links.vo.*;

/**
 * 路线-自动 Mapper
 *
 * @author zzy
 */
@Mapper
public interface LinksMapper extends BaseMapperX<LinksDO> {

    default PageResult<LinksDO> selectPage(LinksPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LinksDO>()
                .eqIfPresent(LinksDO::getLocalPortId, reqVO.getLocalPortId())
                .eqIfPresent(LinksDO::getLocalDeviceId, reqVO.getLocalDeviceId())
                .eqIfPresent(LinksDO::getRemotePortId, reqVO.getRemotePortId())
                .eqIfPresent(LinksDO::getActive, reqVO.getActive())
                .eqIfPresent(LinksDO::getProtocol, reqVO.getProtocol())
                .likeIfPresent(LinksDO::getRemoteHostname, reqVO.getRemoteHostname())
                .eqIfPresent(LinksDO::getRemoteDeviceId, reqVO.getRemoteDeviceId())
                .eqIfPresent(LinksDO::getRemotePort, reqVO.getRemotePort())
                .eqIfPresent(LinksDO::getRemotePlatform, reqVO.getRemotePlatform())
                .eqIfPresent(LinksDO::getRemoteVersion, reqVO.getRemoteVersion())
                .eqIfPresent(LinksDO::getManual, reqVO.getManual())
                .eqIfPresent(LinksDO::getIsCritical, reqVO.getIsCritical())
                .likeIfPresent(LinksDO::getSysname, reqVO.getSysname())
                .eqIfPresent(LinksDO::getBoardId, reqVO.getBoardId())
                .orderByDesc(LinksDO::getId));
    }

}